package com.example.yurun_smartmerchants;

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;

public class MainActivity extends FlutterActivity {

    @Override
    public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
        super.configureFlutterEngine(flutterEngine);
        String channel = "flutter/bridge";
        MethodChannel methodChannel = new MethodChannel(flutterEngine.getDartExecutor(), channel);
        methodChannel.setMethodCallHandler(new MethodChannel.MethodCallHandler() {
            @Override
            public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
                if (call.method.equals("getMsg")) {
                    result.success(getMsg());
                } else {
                    result.notImplemented();
                }
            }
        });
    }

    private String getMsg() {
        return "我是Android过来的";
    }
}